home *** CD-ROM | disk | FTP | other *** search
- /*
- common.h image independent information
-
- Ver.1.0 1995-09-02 T.Ogihara
- */
-
- #ifndef _COMMON_h_
- #define _COMMON_h_
-
- #include <appkit/graphics.h>
- #include <stdio.h>
-
- #define Err_OPEN 1
- #define Err_FORMAT 2
- #define Err_MEMORY 3
- #define Err_SHORT 4
- #define Err_ILLG 5
- #define Err_IMPLEMENT 6
- #define Err_SAVE 7
- #define Err_SAV_IMPL 8
- #define Err_EPS_IMPL 9
- #define Err_NOFILE 10
-
- #define Type_none -1
- #define Type_other 0 /* Filter service */
- #define Type_tiff 1
- #define Type_eps 2
- #define Type_gif 3
- #define Type_bmp 4
- #define Type_ppm 5
- #define Type_pcd 6
- #define Type_user 0x11 /* User-specified pipe */
- #define Type_pcx 0x12
- #define Type_mag 0x13
- #define Type_jpg 0x14
- #define viaPipe(t) ((t) > 0 && (0xf0 & (t)))
-
- #define toyviewerTAB "filters"
- #define toyviewerRC ".toyviewerrc"
-
- #define RED 0
- #define GREEN 1
- #define BLUE 2
- #define ALPHA 3
- #define FIXcount 256
-
- #define Horizontal -1
- #define Vertical -2
- #define Negative -3
- #define Clip -4
-
- #define MAXWidth 4096 /* †Łˋþ⁄˛†£²ÿ⁄˛ˋ瘌”˙´ñˆ˝ */
- #define MAX_COMMENT 256
-
- typedef unsigned char paltype[3];
-
- typedef struct {
- int width, height;
- short xbytes; /* ¥—¥⁄¥¨¿û/line */
- short palsteps; /* colors of palette */
- unsigned char type; /* Type_??? */
- unsigned char bits;
- unsigned char numcolors; /* color elements without alpha */
- BOOL isplanar, alpha;
- NXColorSpace cspace;
- paltype *palette;
- unsigned char memo[MAX_COMMENT];
- } commonInfo;
-
- extern int get_short(FILE *);
- extern long get_long(FILE *);
- extern void put_short(int, FILE *);
- extern void put_long(long, FILE *);
- extern int byte_length(int, int);
- extern void errAlert(const char *, int);
-
- extern int optimalBits(unsigned char *, int);
- extern int howManyBits(paltype *, int);
- extern BOOL isGray(paltype *, int);
- extern int allocImage(unsigned char **, int, int, int, BOOL);
- extern void expandImage(unsigned char **,
- unsigned char *, paltype *, int, int, BOOL);
- extern void packImage(unsigned char *, unsigned char *, int, int);
-
- #endif /* _COMMON_h_ */
-